# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Run.V2.Model.GoogleCloudRunV2ResourceRequirements do
  @moduledoc """
  ResourceRequirements describes the compute resource requirements.

  ## Attributes

  *   `cpuIdle` (*type:* `boolean()`, *default:* `nil`) - Determines whether CPU is only allocated during requests (true by default). However, if ResourceRequirements is set, the caller must explicitly set this field to true to preserve the default behavior.
  *   `limits` (*type:* `map()`, *default:* `nil`) - Only `memory` and `cpu` keys in the map are supported. Notes: * The only supported values for CPU are '1', '2', '4', and '8'. Setting 4 CPU requires at least 2Gi of memory. For more information, go to https://cloud.google.com/run/docs/configuring/cpu. * For supported 'memory' values and syntax, go to https://cloud.google.com/run/docs/configuring/memory-limits
  *   `startupCpuBoost` (*type:* `boolean()`, *default:* `nil`) - Determines whether CPU should be boosted on startup of a new container instance above the requested CPU threshold, this can help reduce cold-start latency.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :cpuIdle => boolean() | nil,
          :limits => map() | nil,
          :startupCpuBoost => boolean() | nil
        }

  field(:cpuIdle)
  field(:limits, type: :map)
  field(:startupCpuBoost)
end

defimpl Poison.Decoder, for: GoogleApi.Run.V2.Model.GoogleCloudRunV2ResourceRequirements do
  def decode(value, options) do
    GoogleApi.Run.V2.Model.GoogleCloudRunV2ResourceRequirements.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Run.V2.Model.GoogleCloudRunV2ResourceRequirements do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
